<template>
  <view class="BatteryBox">
    <image v-if="number === 0" src="@/static/batteryb.png" alt=""></image>
    <image v-else src="@/static/batterya.png" alt=""></image>
    <div class="BatteryBox_items">
      <span v-for="item in number" :key="item"></span>
    </div>
  </view>
</template>

<script>
export default {
  name: "BatteryBox",
  props: {
    number: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {};
  },
};
</script>

<style lang="scss">
.BatteryBox {
  position: relative;
  width: 74rpx;
  height: 40rpx;
  image {
    width: 74rpx;
    height: 40rpx;
  }
  .BatteryBox_items {
    width: 74rpx;
    height: 40rpx;
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    top: 0;
    left: 0;
    display: flex;
    justify-content: flex-start;
    padding-left: 17%;
    > span {
      margin-top: 16%;
      display: inline-block;
      width: 8rpx;
      height: 40%;
      background-color: #1995ff;
      margin-right: 5rpx;
    }
  }
}
</style>
